package com.ktgj.demo.controller;

import com.ktgj.common.core.web.controller.BaseController;
import com.ktgj.common.core.web.domain.AjaxResult;
import com.ktgj.demo.service.UserService;
import com.ktgj.system.api.RemoteUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@ControllerAdvice
@RestController
@RequestMapping("/user")
public class UserController extends BaseController {
    @Autowired
    private UserService userService;

    @Autowired
    private RemoteUserService remoteUserService;

    @GetMapping("/queryAll")
    public AjaxResult queryAll() {
        return AjaxResult.success(userService.queryAll());
    }

    @GetMapping("userInfo/{username}")
    public AjaxResult userInfo(@PathVariable("username") String username) {
        return AjaxResult.success(remoteUserService.getUserInfo(username));
    }

}
